import { defineStore } from 'pinia'

export const useCounterStore = defineStore('counter', {
  state: () => ({ count: 0, random: '0' }),
  persist: {
    enabled: true,
    strategies: [
      {
        storage: localStorage,
        paths: ["count", 'random'],
      },
    ],
  },
  actions: {
    increment() {
      this.count++
      this.random = (Math.random() + '').slice(-16)
    },
  },
})
